// App.tsx
import React, { FC } from 'react';
import './index.less';
import { Navigate, RouterProvider, createBrowserRouter } from 'react-router-dom';
import Layout from '@/components/Layout/index';
import Login from '@/views/login/index';
import Home from '@/views/home/index';
import NotFound from '@/views/404';
import ProjectList from './views/project/list';

const routeConfig = [
  {
    path: '/',
    element: <Navigate to="/login" />,
  },
  {
    path: '/login',
    element: <Login />,
    meta: {
      requiresAuth: false,
      title: '登录页',
      key: 'login',
    },
  },
  {
    element: <Layout />,
    children: [
      {
        path: 'home',
        element: <Home />,
      },
    ],
  },
  {
    element: <Layout />,
    children: [
      {
        path: '/project',
        children: [
          {
            path: 'list',
            element: <ProjectList />,
          },
        ],
      },
    ],
  },
  {
    path: '*',
    Component: NotFound,
  },
];

const router = createBrowserRouter(routeConfig);
const App: FC = () => {
  return <RouterProvider router={router} />;
};

export default App;
